

public class Player extends PlaygroundElement{
	private boolean setbomb;
	public boolean alive = true;
	public int num;
	public Player(int x, int y, Game parent, int num) {
		this.x=x;
		this.y=y;
		this.parent=parent;
		this.num=num;
		setbomb=false;
		
	}
	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
		System.out.println("new PlayerPosition:"+x+":"+y);
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
		System.out.println("new PlayerPosition:"+x+":"+y);
	}
	public void setPos(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	public int getType() {
		return 2;
	}
	
	public void goLeft(){		
		if (parent.pg.moveObject(x, y, x-1, y)){
		if (setbomb) {try {
			new Bomb(x,y,parent);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}setbomb=false;}
		x=x-1; 
		System.out.println("new PlayerPosition:"+x+":"+y);
		} else System.out.println("Block!!");
	}
	
	
	public void goRight(){		
		if (parent.pg.moveObject(x, y, x+1, y)){
		if (setbomb) {try {
			new Bomb(x,y,parent);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}setbomb=false;}
		x=x+1; 
		System.out.println("new PlayerPosition:"+x+":"+y);
		} else System.out.println("Block!!");
	}

	public void goUp(){
		if (parent.pg.moveObject(x, y, x, y-1)){
		if (setbomb) {try {
			new Bomb(x,y,parent);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}setbomb=false;}	
		y=y-1; 
		System.out.println("new PlayerPosition:"+x+":"+y);
		} else System.out.println("Block!!");
	}
	
	public void goDown(){		
		if (parent.pg.moveObject(x, y, x, y+1)){
		if (setbomb) {try {
			new Bomb(x,y,parent);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}setbomb=false;}	
		y=y+1; 
		System.out.println("new PlayerPosition:"+x+":"+y);
		} else System.out.println("Block!!");
	}
	
	public void setBomb() {
			setbomb=true;
	}
	
	public void die() {
		alive=false;
		parent.removeDead();
	}
}
